#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 2000001;
int a[MAXN];
signed main()
{
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) {
		a[i] = a[i - 1] + i;
	}
	for (int i = 1; i < n; i++) {
		int mid = a[i - 1] + n;
		int aa = lower_bound(a, a + n + 1, mid) - a;
		if (a[aa] - a[i - 1] == n) {
			if (i != aa) {
				cout << i << " " << aa << endl;
			}
		}
	}

	return 0;
}
